﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Microsoft.Office.OneNote;

namespace OneNoteFrameworkTests
{
    [TestFixture]
    public class PropertyTests
    {
        [Test]
        public void NewInstanceProvider()
        {
            TestObject obj = new TestObject();
            Assert.IsNotNull(obj.Test);
            Assert.AreEqual("VALUE", obj.Test.Value);
        }

        private class TestObject : OneNoteObject
        {
            public static readonly OneNoteProperty TestProperty = OneNoteProperty.Register(
                "test", typeof(TestObjectValue), typeof(TestObject), DefaultValueProvider.NewInstance<TestObjectValue>());

            public TestObjectValue Test
            {
                get { return GetValue<TestObjectValue>(TestProperty); }
            }
        }

        private class TestObjectValue
        {
            public string Value;

            public TestObjectValue()
            {
                Value = "VALUE";
            }
        }
    }
}
